<?php

namespace App\Models\Customer;

use App\Models\Admin\AdminUser;
use App\Models\Admin\CustomerGroup;
use App\Models\Admin\GroupList;
use App\Models\Communicationlog;
use Illuminate\Database\Eloquent\Model;

/**
 * Class Customer
 * @property Follow $follow
 * @property AdminUser $user
 * @property CustomerSource $sources
 * @property Communicationlog $communicateLog
 * @package App\Models\Customer
 */
class Customer extends Model
{
    protected $table='customer';

    public function follow(){
        return $this->hasMany(Follow::class, "customer_id", "id");
    }

    public function user(){
        return $this->hasOne(AdminUser::class, "id", "recommend");
    }

    public function group(){
        return $this->hasMany(CustomerGroup::class, "customer_id", "id");
    }

    public function sources(){
        return $this->hasMany(CustomerSource::class, "customer_id", "id");
    }

    public function communicateLog(){
        return $this->hasMany(Communicationlog::class, "member_id", "id");
    }

    public function communicateLogOne(){
        return $this->hasOne(Communicationlog::class, "member_id", "id");
    }
}
